<template>
  <div class="warp">
    <div class="warp-top" v-if="$route.path!=='/login'">
      <el-menu theme="dark" default-active="1" class="el-menu-demo" mode="horizontal" @select="handleSelect">
          <li class="logo"><router-link to="/">中山好人</router-link></li>
        <el-menu-item index="1">处理中心</el-menu-item>
        <el-submenu index="2">
          <template slot="title">我的工作台</template>
          <el-menu-item index="2-1">选项1</el-menu-item>
          <el-menu-item index="2-2">选项2</el-menu-item>
          <el-menu-item index="2-3">选项3</el-menu-item>
        </el-submenu>
        <el-menu-item index="3"><a href="https://www.ele.me" target="_blank">订单管理</a></el-menu-item>
        <el-dropdown class="user" :hide-on-click="false">
          <a class="avatar el-dropdown-link">
            <img  v-if="$store.state.auth.user" :src="$store.state.auth.user.avatar"/>
          </a>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item ><a @click="logOut">退出登陆</a> </el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </el-menu>
    </div>
    <router-view></router-view>

  </div>
</template>

<script>

export default {
  methods: {
    handleSelect(key, keyPath) {
        console.log(key, keyPath);
      },
      logOut:function(){
          this.$store.dispatch('logOut');
          this.$router.push({path:'/login'});
      }
  }
}
</script>

<style >
html,body,.warp{
  height:100%;
  width:100%;
  overflow:hidden;
}
body {
  font-family: Helvetica, sans-serif;
  margin:0;
}
.warp{
  display:flex;
  flex-direction: column;
}
.warp-bom{
  flex:1;
}
.warp-left,.warp-right,.warp-left .el-menu{
  height:100%;
}
.el-menu{
    border-radius:0;
}
.warp-right{
    padding:30px;
    background:#eee;
}
</style>
